<%@ page contentType="text/html;charset=UTF-8"%>
<%@include file="/WEB-INF/views/include/taglib.jsp"%>
<!DOCTYPE html>
<html lang="en">
<head>
<%@include file="/WEB-INF/views/include/top.jsp"%>
<style type="text/css">
</style>
<title>其它设置</title>
<script type="text/javascript" src="${ctxAssets}/js/lib/jquery/jquery-1.10.2.js"></script>
<script type="text/javascript" src="${ctxAssets}/js/lib/kkpager.min.js"></script>
<link rel="stylesheet" type="text/css" href="${ctxAssets}/css/kkpager/kkpager_blue.css" />
</head>
<body>
	<div id="abc"></div>
	<div style="width: 800px; margin: 0 auto;">
		<div id="kkpager"></div>
	</div>


	<script type="text/javascript">
		//init
		$(function() {
			var webRoot = G_WEB_ROOT;
			var urls = {
				findProductListByClassifyId : webRoot+'/pc/findProductListByClassifyId'
			}
			var totalPage = 0;
			var totalRecords = 0;
			var pageNo = null;
			if (!pageNo) { pageNo = 1; }
			$.post(urls.findProductListByClassifyId, {'pageNo':1, 'classifyId':1}, function(rs){
				var html ='';
				$.each(rs.productDtos, function(index, item){
						html += item.name;
				});
				$("#abc").empty().append(html);
				
				totalPage = rs.totalPage;
				totalRecords = rs.totalRecords;
				//生成分页
				//有些参数是可选的，比如lang，若不传有默认值
				kkpager.generPageHtml({
					mode:'click',
					pno : pageNo,
					//总页码
					total : totalPage,
					//总数据条数
					totalRecords : totalRecords,
					//链接前部
					hrefFormer : 'pager_test',
					//链接尾部
//	 				hrefLatter : '.html',
					click : function(n){
				        //这里可以做自已的处理
				        alert(n);
				        //处理完后可以手动条用selectPage进行页码选中切换
				        	$.post(urls.findProductListByClassifyId, {'pageNo':n, 'classifyId':1}, function(rs){
								var html ='';
								$.each(rs.productDtos, function(index, item){
										html += item.name;
								});
								$("#abc").empty().append(html);
							});
				        
				        this.selectPage(n);
				    },
				});
			});

		});
	</script>
</body>
</html>